while !isBlocked {
    while !isOnGem {
        moveForward()
    }

    collectGem()
    turnLeft()
}